package co.fitstart.entity.finance;

import java.util.Date;

import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;

import co.fitstart.entity.order.ExpenseType;
import co.fitstart.entity.order.Order;

/**
 * 
 * @author dan
 *
 */
@Entity
@Table(name = "order_invoice_record")
@JsonIgnoreProperties(value={"hibernate_lazy_initializer","handler","fieldHandler"})
public class OrderInvoiceRecord {
    
    @Id
    @GeneratedValue
    private Long id;
    
    /** 税号 */
    private String dutyParagraph;
    
    /** 公司名称 */
    private String companyName;
    
    /** 费用明细 */
    private ExpenseType expenseType;
    
    /** 备注 */
    private String remarks;
    
    @ManyToOne(fetch = FetchType.LAZY, optional = false) 
    private Order order;
    
    /** 创建时间 */
    private Date createTime;
    
    /** 操作人 */
    private Long operator;
    
    /** 是否开具发票 */
    private boolean invoice;
    
    /** 是否导出销售发票 */
    private boolean exportInvoice;
    
    /**
     * 
     */
    public OrderInvoiceRecord() {
        
    }
    
    /**
     * 
     * @param order
     * @param operator
     * @return
     */
    public OrderInvoiceRecord initilization(Order order, Long operator) {
        this.order = order;
        this.createTime = new Date();
        this.operator = operator;
        this.invoice = false;
        this.exportInvoice = false;
        return this;
    }
    
    /**
     * 
     * @return
     */
    public OrderInvoiceRecord invoice() {
        this.invoice = true;
        return this;
    }

    /**
     * @return the id
     */
    public Long getId() {
        return id;
    }

    /**
     * @return the dutyParagraph
     */
    public String getDutyParagraph() {
        return dutyParagraph;
    }

    /**
     * @return the companyName
     */
    public String getCompanyName() {
        return companyName;
    }

    /**
     * @return the expenseType
     */
    public ExpenseType getExpenseType() {
        return expenseType;
    }

    /**
     * @return the remarks
     */
    public String getRemarks() {
        return remarks;
    }

    /**
     * @return the order
     */
    public Order getOrder() {
        return order;
    }

    /**
     * @return the createTime
     */
    public Date getCreateTime() {
        return createTime;
    }

    /**
     * @return the operator
     */
    public Long getOperator() {
        return operator;
    }

    /**
     * @return the invoice
     */
    public boolean isInvoice() {
        return invoice;
    }

    /**
     * @return the exportInvoice
     */
    public boolean isExportInvoice() {
        return exportInvoice;
    }

    /**
     * @param id the id to set
     */
    public void setId(Long id) {
        this.id = id;
    }

    /**
     * @param dutyParagraph the dutyParagraph to set
     */
    public void setDutyParagraph(String dutyParagraph) {
        this.dutyParagraph = dutyParagraph;
    }

    /**
     * @param companyName the companyName to set
     */
    public void setCompanyName(String companyName) {
        this.companyName = companyName;
    }

    /**
     * @param expenseType the expenseType to set
     */
    public void setExpenseType(ExpenseType expenseType) {
        this.expenseType = expenseType;
    }

    /**
     * @param remarks the remarks to set
     */
    public void setRemarks(String remarks) {
        this.remarks = remarks;
    }

    /**
     * @param order the order to set
     */
    public void setOrder(Order order) {
        this.order = order;
    }

    /**
     * @param createTime the createTime to set
     */
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    /**
     * @param operator the operator to set
     */
    public void setOperator(Long operator) {
        this.operator = operator;
    }

    /**
     * @param invoice the invoice to set
     */
    public void setInvoice(boolean invoice) {
        this.invoice = invoice;
    }

    /**
     * @param exportInvoice the exportInvoice to set
     */
    public void setExportInvoice(boolean exportInvoice) {
        this.exportInvoice = exportInvoice;
    }

}
